#_*_coding:utf8_*_
import urllib2
import json

def get_token():
    url='http://10.20.32.86:8000/login'
    #http头这个就不介绍了
    headers ={"Content-type":"application/json","Accept": "application/json"}
    #参数
    params=json.dumps(
              {"eauth":"pam","username":"salt","password":"salt"})
    #这里并不是真的开始访问而是将信息组合起来
    req = urllib2.Request(url,params,headers)
    #这才是正真打开web页面
    respones = urllib2.urlopen(req)
    result=json.loads(respones.read())
    #获取salt token
    token=result['return'][0]['token']
    return token

